package com.ce.pms.charge.web;

import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

import com.ce.pms.base.web.PmsBaseAction;
import com.ce.pms.charge.service.IChargeStaService;
import com.ce.pms.charge.vo.ChargeStaVO;
import com.ce.pms.charge.vo.ChargeStaVersionVO;
import com.ce.pms.charge.vo.GeneralVersionVO;
import com.ce.pms.charge.vo.MeterVersionVO;
import com.ce.pms.charge.vo.SectionStandardVO;
import com.ce.pms.common.model.SysrefcodeDO;
import com.ce.util.BlankUtil;
import com.sitechasia.webx.core.annotation.Read;
import com.sitechasia.webx.core.support.Page;

public class ChargeStandardAction extends PmsBaseAction {
	private IChargeStaService chargeStaService;


	public void setChargeStaService(IChargeStaService chargeStaService) {
		this.chargeStaService = chargeStaService;
	}


	/**
	 * 功能描述:  初始化收费标准列表<br>
	 * @param pageNO
	 * @param pageSize
	 * @param chargeItemId
	 * @param type
	 * @return
	 * Create author:yandawei <br>
	 * Create on:2008-8-11  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public String initChargeStandardListBy(
			@Read(key = "ec_p", defaultValue = "1") Integer pageNO,
			@Read(key = "ec_crd",defaultValue = "15")Integer pageSize,
			@Read(key = "chargeItemId") Long chargeItemId,
			@Read(key ="chargeItemType") String type)
	{
		Page page = chargeStaService.queryChargeSatByPage(chargeItemId, pageNO, pageSize);
		if(!BlankUtil.isBlank(page)){
			setAttribute("standardList", page.getResult());
			setAttribute("totalRows",Integer.valueOf(String.valueOf(page.getTotalCount())));
		}else{
			setAttribute("totalRows",new Integer(0));
		}
		setAttribute("chargeItemType", type);
		setAttribute("chargeItemId", chargeItemId);
		return getTargetPageByType(type);
	}

	/***
	 * 功能描述:  常规类型项目标准新增初始化<br>
	 * @param name
	 * @return
	 * Create author:yandawei <br>
	 * Create on:2008-8-12  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public String initGeneralStandardAdd(
			@Read(key = "chargeItemName") String name,
			@Read(key="chargeItemId") Long id,
			@Read(key ="chargeItemType") String chargeItemType)
	{

		setChargeItemNameAndId(name,id);
		setAttribute("chargeItemType",chargeItemType);
		setAttribute("editFlag", "add");
		return "initGeneralStandard";
	}

	/***
	 * 功能描述: 增加常规收费项目标准<br>
	 * @param chargeStandard
	 * @param generalVersion
	 * Create author:yandawei <br>
	 * Create on:2008-8-11  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public void addGeneralStandard(
			@Read ChargeStaVO chargeStandard,
			@Read GeneralVersionVO generalVersion)
	{
		Set<SectionStandardVO> sectionStandardVOSet = null;
		generalVersion.setCreator(getUserId());
		if(!BlankUtil.isBlank(generalVersion.getSectionStardStr()))
		{
			sectionStandardVOSet = getSectionStandarSet(generalVersion);
		}
		else//单一收费
		{
			generalVersion.setPrice(new BigDecimal(generalVersion.getSectionStardStr()));
		}
		chargeStaService.addChargeStaAndVersion(chargeStandard, generalVersion, sectionStandardVOSet);
		this.renderText("true");
	}

	/***
	 * 功能描述:  常规收费项目标准修改初始化<br>
	 * @param id
	 * @param name
	 * @return
	 * Create author:yandawei <br>
	 * Create on:2008-8-12  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public String initGeneralStandardEdit(
			@Read(key="keyword") Long id,
			@Read(key = "chargeItemName") String name,
			@Read(key= "chargeItemId")Long chargeItemId,
			@Read(key ="chargeItemType") String chargeItemType)
	{
		getChargeStandardAndVersionInfo(id, SysrefcodeDO.FEE_CHAR_TYPE_CLASS_CODE_GENERAL);
		//setChargeItemNameAndId(name,chargeItemId);
		setAttribute("editFlag", "update");
		setAttribute("chargeItemType",chargeItemType);
		return "initGeneralStandard";
	}

	/***
	 * 功能描述:  修改常规收费项目标准<br>
	 * @param chargeStandard
	 * @param generalVersion
	 * Create author:yandawei <br>
	 * Create on:2008-8-12  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public void editGeneralStandard(
			@Read ChargeStaVO chargeStandard,
			@Read GeneralVersionVO generalVersion)
	{
		generalVersion.setModifier(getUserId());
		generalVersion.setCreator(getUserId());
		Set<SectionStandardVO> sectionStandardVOSet = null;
		if(!BlankUtil.isBlank(generalVersion.getSectionStardStr()))
		{
			sectionStandardVOSet = getSectionStandarSet(generalVersion);
		}
		chargeStaService.editChargeStaAndVersion(chargeStandard, generalVersion, sectionStandardVOSet);
		this.renderText("true");
	}

	/***
	 * 功能描述: 删除常规收费项目标准 <br>
	 * @param id
	 * Create author:yandawei <br>
	 * Create on:2008-8-12  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public void deleteGeneralStandard(@Read(key = "keyword") Long id)
	{
		chargeStaService.deleteChargeSta(id);
		this.renderText("true");
	}

	/***
	 * 功能描述:  获取常规收费项目标准详细信息<br>
	 * @param id
	 * @return
	 * Create author:yandawei <br>
	 * Create on:2008-8-12  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public String getGeneralStandardDetailById(
			@Read(key = "keyword") Long id,
			@Read(key = "chargeItemType") String chargeItemType)
	{
		getChargeStandardAndVersionInfo(id, SysrefcodeDO.FEE_CHAR_TYPE_CLASS_CODE_GENERAL);
		setAttribute("chargeItemType", chargeItemType);
		return "generalStandardDetail";
	}


	/***
	 * 功能描述:  走表收费标准新增初始化<br>
	 * @param name
	 * @param id
	 * @return
	 * Create author:yandawei <br>
	 * Create on:2008-8-14  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public String initMeterStandardAdd(
			@Read(key = "chargeItemName") String name,
			@Read(key="chargeItemId") Long id,
			@Read(key ="chargeItemType") String chargeItemType)
	{
		setChargeItemNameAndId(name,id);
		setAttribute("editFlag", "add");
		setAttribute("chargeItemType",chargeItemType);
		return "initMeterStandard";
	}


	/***
	 * 功能描述: 增加走表收费项目标准<br>
	 * @param chargeStandard
	 * @param generalVersion
	 * Create author:yandawei <br>
	 * Create on:2008-8-11  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public void addMeterStandard(
			@Read ChargeStaVO chargeStandard,
			@Read MeterVersionVO meterVersion)
	{
		Set<SectionStandardVO> sectionStandardVOSet = null;
		meterVersion.setCreator(getUserId());
		if(!BlankUtil.isBlank(meterVersion.getSectionStardStr()))
		{
			sectionStandardVOSet = getSectionStandarSet(meterVersion);
		}
		else//单一收费
		{
			meterVersion.setPrice(new BigDecimal(meterVersion.getSectionStardStr()));
		}
		chargeStaService.addChargeStaAndVersion(chargeStandard, meterVersion, sectionStandardVOSet);
		this.renderText("true");
	}

	/***
	 * 功能描述:  走表收费项目标准修改初始化<br>
	 * @param id
	 * @param name
	 * @return
	 * Create author:yandawei <br>
	 * Create on:2008-8-12  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public String initMeterStandardEdit(
			@Read(key="keyword") Long id,
			@Read(key = "chargeItemName") String name,
			@Read(key= "chargeItemId")Long chargeItemId,
			@Read(key ="chargeItemType") String chargeItemType)
	{
		getChargeStandardAndVersionInfo(id, SysrefcodeDO.FEE_CHAR_TYPE_CLASS_CODE_METER);
		setAttribute("editFlag", "update");
		setAttribute("chargeItemType",chargeItemType);
		return "initMeterStandard";
	}

	/**
	 * 功能描述: 修改走表收费项目标准<br>
	 * @param chargeStandard
	 * @param meterVersion
	 * Create author:yandawei <br>
	 * Create on:2008-8-14  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public void editMeterStandard(
			@Read ChargeStaVO chargeStandard,
			@Read MeterVersionVO meterVersion)
	{
		meterVersion.setModifier(getUserId());
		meterVersion.setCreator(getUserId());
		Set<SectionStandardVO> sectionStandardVOSet = null;
		if(!BlankUtil.isBlank(meterVersion.getSectionStardStr()))
		{
			sectionStandardVOSet = getSectionStandarSet(meterVersion);
		}
		chargeStaService.editChargeStaAndVersion(chargeStandard, meterVersion, sectionStandardVOSet);
		this.renderText("true");
	}

	/***
	 * 功能描述: 删除走表收费项目标准 <br>
	 * @param id
	 * Create author:yandawei <br>
	 * Create on:2008-8-12  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public void deleteMeterStandard(@Read(key = "keyword") Long id)
	{
		chargeStaService.deleteChargeSta(id);
		this.renderText("true");
	}

	/***
	 * 功能描述:   获取走表收费项目标准详细信息<br>
	 * @param id
	 * @return
	 * Create author:yandawei <br>
	 * Create on:2008-8-14  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public String getMeterStandardDetailById(
			@Read(key = "keyword") Long id,
			@Read(key = "chargeItemType") String chargeItemType)
	{
		getChargeStandardAndVersionInfo(id, SysrefcodeDO.FEE_CHAR_TYPE_CLASS_CODE_METER);
		setAttribute("chargeItemType", chargeItemType);
		return "meterStandardDetail";
	}

	/***
	 * 功能描述:  固定类型标准新增初始化<br>
	 * @param name
	 * @param id
	 * @return
	 * Create author:yandawei <br>
	 * Create on:2008-8-14  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public String initFixedStandardAdd(
			@Read(key = "chargeItemName") String name,
			@Read(key="chargeItemId") Long id)
	{
		setChargeItemNameAndId(name,id);
		setAttribute("editFlag", "add");
		return "initFixedStandard";
	}

	/***
	 * 功能描述:   新增固定类型标准<br>
	 * @param chargeStandard
	 * @param fixedVersion
	 * Create author:yandawei <br>
	 * Create on:2008-8-14  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public void addFixedStandard(
			@Read ChargeStaVO chargeStandard,
			@Read ChargeStaVersionVO fixedVersion)
	{
		fixedVersion.setCreator(getUserId());
		chargeStaService.addChargeStaAndVersion(chargeStandard, fixedVersion, null);
		this.renderText("true");
	}

	/***
	 * 功能描述:  固定类型标准修改初始化<br>
	 * @param id
	 * @param name
	 * @param chargeItemId
	 * @return
	 * Create author:yandawei <br>
	 * Create on:2008-8-14  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public String initFixedStandardEdit(
			@Read(key="keyword") Long id,
			@Read(key = "chargeItemName") String name,
			@Read(key= "chargeItemId")Long chargeItemId)
	{
		getChargeStandardAndVersionInfo(id, SysrefcodeDO.FEE_CHAR_TYPE_CLASS_CODE_FIXED);
		setAttribute("editFlag", "update");
		return "initFixedStandard";
	}

	/***
	 * 功能描述:  修改固定类型标准<br>
	 * @param chargeStandard
	 * @param meterVersion
	 * Create author:yandawei <br>
	 * Create on:2008-8-14  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public void editFixedStandard(
			@Read ChargeStaVO chargeStandard,
			@Read ChargeStaVersionVO fixedVersion)
	{
		fixedVersion.setModifier(getUserId());
		fixedVersion.setCreator(getUserId());
		chargeStaService.editChargeStaAndVersion(chargeStandard, fixedVersion, null);
		this.renderText("true");
	}


	/***
	 * 功能描述: 删除固定收费项目标准 <br>
	 * @param id
	 * Create author:yandawei <br>
	 * Create on:2008-8-12  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public void deleteFixedStandard(@Read(key = "keyword") Long id)
	{
		chargeStaService.deleteChargeSta(id);
		this.renderText("true");
	}

	/***
	 * 功能描述:  获取固定收费项目标准详细信息<br>
	 * @param id
	 * @return
	 * Create author:yandawei <br>
	 * Create on:2008-8-14  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public String getFixedStandardDetailById(@Read(key = "keyword") Long id)
	{
		getChargeStandardAndVersionInfo(id, SysrefcodeDO.FEE_CHAR_TYPE_CLASS_CODE_FIXED);
		return "fixedStandardDetail";
	}


	/***
	 * 功能描述:  其它类型标准新增初始化<br>
	 * @param name
	 * @param id
	 * @return
	 * Create author:yandawei <br>
	 * Create on:2008-8-14  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public String initOtherStandardAdd(
			@Read(key = "chargeItemName") String name,
			@Read(key="chargeItemId") Long id)
	{
		setChargeItemNameAndId(name,id);
		setAttribute("editFlag", "add");
		return "initOtherStandard";
	}


	/***
	 * 功能描述:   新增其它类型标准<br>
	 * @param chargeStandard
	 * @param fixedVersion
	 * Create author:yandawei <br>
	 * Create on:2008-8-14  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public void addOtherStandard(
			@Read ChargeStaVO chargeStandard,
			@Read ChargeStaVersionVO otherVersion)
	{
		otherVersion.setCreator(getUserId());
		chargeStaService.addChargeStaAndVersion(chargeStandard, otherVersion, null);
		this.renderText("true");
	}


	/***
	 * 功能描述:  其它类型标准修改初始化<br>
	 * @param id
	 * @param name
	 * @param chargeItemId
	 * @return
	 * Create author:yandawei <br>
	 * Create on:2008-8-14  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public String initOtherStandardEdit(@Read(key="keyword") Long id,
			@Read(key = "chargeItemName") String name,
			@Read(key= "chargeItemId")Long chargeItemId)
	{
		getChargeStandardAndVersionInfo(id, SysrefcodeDO.FEE_CHAR_TYPE_CLASS_CODE_OTHER);
		setAttribute("editFlag", "update");
		return "initOtherStandard";
	}


	/***
	 * 功能描述:  修改走表类型标准<br>
	 * @param chargeStandard
	 * @param meterVersion
	 * Create author:yandawei <br>
	 * Create on:2008-8-14  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public void editOtherStandard(
			@Read ChargeStaVO chargeStandard,
			@Read ChargeStaVersionVO otherVersion)
	{
		otherVersion.setModifier(getUserId());
		otherVersion.setCreator(getUserId());
		chargeStaService.editChargeStaAndVersion(chargeStandard, otherVersion, null);
		this.renderText("true");
	}

	/***
	 * 功能描述: 删除其它收费项目标准 <br>
	 * @param id
	 * Create author:yandawei <br>
	 * Create on:2008-8-12  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public void deleteOtherStandard(@Read(key = "keyword") Long id)
	{
		chargeStaService.deleteChargeSta(id);
		this.renderText("true");
	}

	/***
	 * 功能描述:  获取其它收费项目标准详细信息<br>
	 * @param id
	 * @return
	 * Create author:yandawei <br>
	 * Create on:2008-8-14  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public String getOtherStandardDetailById(@Read(key = "keyword") Long id)
	{
		getChargeStandardAndVersionInfo(id, SysrefcodeDO.FEE_CHAR_TYPE_CLASS_CODE_OTHER);
		return "otherStandardDetail";
	}


	/***
	 * 功能描述:  验证收费标准名称是否以被使用<br>
	 * @param id
	 * @param name
	 * Create author:yandawei <br>
	 * Create on:2008-8-27  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public void checkStanardName(@Read(key="keyword") Long id,
			@Read(key="staName") String name)
	{
		String result = "true";
		boolean unique = chargeStaService.checkChargeStaNameIsOnly(name, id);
		if(unique)
		{
			result = getLocaleMessage("charge:chargeStandardExist");
		}
		renderText(result);
	}

	public String queryChargeSelectList(@Read(key="staName") String name){
		List<ChargeStaVO> list=chargeStaService.queryChargeSelectList(name);
		this.getRequest().setAttribute("chargeSelectList", list);
		this.getRequest().setAttribute("totalRows", new Integer(list.size()<10?10:list.size()));
		return "standardSelect";
	}


	/***
	 * 功能描述: 根据类型code跳转到相应的列表显示界面 <br>
	 * @param type
	 * @return
	 * Create author:yandawei <br>
	 * Create on:2008-8-12  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	private String getTargetPageByType(String type)
	{
		String url = null;
		if(SysrefcodeDO.FEE_CHAR_TYPE_CLASS_CODE_GENERAL.equals(type))
		{
			url = "generalChargeList";
		}
		else if(SysrefcodeDO.FEE_CHAR_TYPE_CLASS_CODE_METER.equals(type))
		{
			url = "meterChargeList";
		}
		else if(SysrefcodeDO.FEE_CHAR_TYPE_CLASS_CODE_FIXED.equals(type))
		{
			url = "fixedChargeList";
		}
		else if(SysrefcodeDO.FEE_CHAR_TYPE_CLASS_CODE_OTHER.equals(type))
		{
			url = "otherChargeList";
		}
		return url;
	}


	/***
	 * 功能描述:  将多个分段收费VO添加到Set集合中<br>
	 * @param sectionStandardStr
	 * @return
	 * Create author:yandawei <br>
	 * Create on:2008-8-12  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	private Set<SectionStandardVO> getSectionStandarSet(ChargeStaVersionVO chargeStandard)
	{
		Set<SectionStandardVO> sectionStandardVOSet = null;
		if(!BlankUtil.isBlank(chargeStandard.getSectionStardStr()))
		{
			String[] sec = chargeStandard.getSectionStardStr().split(";");
			if(sec.length > 1)
			{
				sectionStandardVOSet = new TreeSet<SectionStandardVO>();
				for(String str : sec)
				{
					sectionStandardVOSet.add(getSectionStandarStr(str));
				}
			}
			else//单一收费
			{
				chargeStandard.setPrice(new BigDecimal(chargeStandard.getSectionStardStr()));
			}
		}
		return sectionStandardVOSet;
	}


	/***
	 * 功能描述:  把[0,30,12.5]字符串转换为分段收费VO对象<br>
	 * @param sect
	 * @return
	 * Create author:yandawei <br>
	 * Create on:2008-8-12  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	private SectionStandardVO getSectionStandarStr(String sect)
	{
		SectionStandardVO section = null;
		if(!BlankUtil.isBlank(sect))
		{
			String[] str = sect.split(",");
			if(str.length > 0)
			{
				section = new SectionStandardVO();
				section.setCreator(getUserId());
				section.setStartPoint(new BigDecimal(str[0]));
				section.setToPoint(new BigDecimal(str[1]));
				section.setPrice(new BigDecimal(str[2]));
			}
		}
		return section;
	}


	/***
	 * 功能描述:  设置收费标准中的收费项目信息<br>
	 * @param name
	 * @param id
	 * Create author:yandawei <br>
	 * Create on:2008-8-12  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	private void setChargeItemNameAndId(String name,Long id)
	{
		try {
			name = java.net.URLDecoder.decode(name, "utf-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		ChargeStaVO chargeStandard = new ChargeStaVO();
		chargeStandard.setChargeItemName(name);
		chargeStandard.setChargeItemId(id);
		setAttribute("chargeStandard", chargeStandard);
	}

	/***
	 * 功能描述:  根据ID获取收费标准及其当前版本的信息<br>
	 * @param id
	 * @param type
	 * Create author:yandawei <br>
	 * Create on:2008-8-12  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	private void getChargeStandardAndVersionInfo(Long id,String type)
	{
		ChargeStaVO chargeStandard = chargeStaService.findChargeStaById(id);
		if(SysrefcodeDO.FEE_CHAR_TYPE_CLASS_CODE_GENERAL.equals(type))
		{
			GeneralVersionVO generalVersion =  (GeneralVersionVO) chargeStaService.findVersionByChargeStaId(id);
			setSectionStandardSet(generalVersion);
			setAttribute("chargeStandardVersion", generalVersion);
		}
		else if(SysrefcodeDO.FEE_CHAR_TYPE_CLASS_CODE_METER.equals(type))
		{
			MeterVersionVO meterVersion =  (MeterVersionVO) chargeStaService.findVersionByChargeStaId(id);
			setSectionStandardSet(meterVersion);
			setAttribute("chargeStandardVersion", meterVersion);
		}
		else if(SysrefcodeDO.FEE_CHAR_TYPE_CLASS_CODE_FIXED.equals(type))
		{
			ChargeStaVersionVO fiexedVersion =   chargeStaService.findVersionByChargeStaId(id);
			setAttribute("chargeStandardVersion", fiexedVersion);
		}
		else if(SysrefcodeDO.FEE_CHAR_TYPE_CLASS_CODE_OTHER.equals(type))
		{
			ChargeStaVersionVO otherVersion =   chargeStaService.findVersionByChargeStaId(id);
			setAttribute("chargeStandardVersion", otherVersion);
		}
		setAttribute("chargeStandard", chargeStandard);
	}

	/***
	 * 功能描述:  设置分段计费集合,更新分段计费字符串如(1,2,12.5;2,5,22.5;)<br>
	 * @param version
	 * Create author:yandawei <br>
	 * Create on:2008-8-14  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	private void setSectionStandardSet(ChargeStaVersionVO version)
	{
		if(!BlankUtil.isBlank(version)){
			if(!BlankUtil.isBlank(version.getSectStaVOSet())){
				StringBuffer sectionStandardStr = new StringBuffer();
				Set<SectionStandardVO> sectionStandardset = new TreeSet<SectionStandardVO>(version.getSectStaVOSet());
				for(Iterator it = sectionStandardset.iterator() ; it.hasNext();)
				{
					SectionStandardVO section = (SectionStandardVO) it.next();
					sectionStandardStr.append(section.getStartPoint()).append(",");
					sectionStandardStr.append(section.getToPoint()).append(",");
					sectionStandardStr.append(section.getPrice()).append(";");
				}
				setAttribute("sectionChargeSet", sectionStandardset);//排序set
			    version.setSectionStardStr(sectionStandardStr.toString());
			}
			else
				version.setSectionStardStr(String.valueOf(version.getPrice().setScale(2, BigDecimal.ROUND_HALF_UP)));
		}
	}


}
